package org.mspring.platform.weibo.tencent.entity.dto;

import java.util.Map;

/**
 * 调用API接口返回的结果
 *
 * @author Gao Youbo
 * @since 2014-05-22 13:17:13
 */
public class APIResult {

    private int errcode; //返回错误码
    private String msg; //错误消息
    private int ret; //返回值，0-成功，非0-失败,
    private String seqid; //序列号
    private Map<String, Object> data; //返回数据

    /**
     * 接口调用是否成功
     *
     * @return
     */
    public boolean isSuccess() {
        return ret == 0;
    }

    /**
     * 获取返回数据
     *
     * @param key
     * @return
     */
    public Object get(String key) {
        if (this.data == null) {
            return null;
        }
        return this.data.get(key);
    }

    public int getErrcode() {
        return errcode;
    }

    public void setErrcode(int errcode) {
        this.errcode = errcode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getRet() {
        return ret;
    }

    public void setRet(int ret) {
        this.ret = ret;
    }

    public String getSeqid() {
        return seqid;
    }

    public void setSeqid(String seqid) {
        this.seqid = seqid;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }

}
